package wenjie.chen.receiver.config;

import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.bytesoft.bytetcc.supports.springcloud.config.SpringCloudConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

@Import(SpringCloudConfiguration.class)
@Configuration
@RequiredArgsConstructor
public class JdbcConfig {
    @NonNull
    private final DataSource dataSource;

    @Bean
    public JdbcTemplate getJdbcTemplate() {
        JdbcTemplate jdbcTemplate = new JdbcTemplate();
        jdbcTemplate.setDataSource(dataSource);
        return jdbcTemplate;
    }
}
